//获取雷达图的数据
import { RadarChartList } from '@/services/RadarChart';
import { useEffect, useState } from 'react';

type RadarChartDataType = {
  item: string;
  type: string;
  score: number;
};

const useRadarChartData = (): RadarChartDataType[] => {
  const [radarChart, setRadarChart] = useState<RadarChartDataType[]>([]);

  useEffect(() => {
    const fetchData = async () => {
      try {
        const res = await RadarChartList();
        if (res.success) {
          console.log('radarChartData:', res.data.RadarChart);
          setRadarChart(res.data.RadarChart);
        }
      } catch (error) {
        console.error('Error fetching line chart data:', error);
      }
    };

    fetchData();
  }, []);

  return radarChart;
};

export default useRadarChartData;
